<template>
  <div class="container">
    <el-dialog title="退货单详情" :visible.sync="dialog.centerDialogVisible" @open="getData" center>
      <el-table :data="tableData" border style="width: 100%" empty-text="暂无数据">
        <el-table-column prop="name" label="商品名称" align="center"></el-table-column>
        <!-- <el-table-column prop="productcode" label="商品Code" align="center"></el-table-column> -->
        <el-table-column prop="code" label="商品编码" align="center"></el-table-column>
        <!-- <el-table-column prop="productid" label="商品Id" align="center"></el-table-column> -->
        <el-table-column prop="qty" label="数量" align="center"></el-table-column>
        <el-table-column prop="cost" label="成本价" align="center"></el-table-column>
        <el-table-column prop="costmoney" label="成本金额" align="center"></el-table-column>
        <el-table-column prop="profitvalue" label="预提" align="center"></el-table-column>
        <el-table-column prop="spillfoldvalue" label="溢折" align="center"></el-table-column>
        <el-table-column prop="allocateprice" label="调货提成" align="center"></el-table-column>
        <el-table-column prop="packagingboxprofitvalue" label="筐提成" align="center"></el-table-column>
        <el-table-column prop="inp_price" label="入库价" align="center"></el-table-column>
      </el-table>
      <!-- <div class="pagination">
        <el-pagination
          @size-change="handleCurrentChange"
          @current-change="handleSizeChange"
          :current-page.sync="pageData.page"
          :page-sizes="pageData.pageSizes"
          :page-size="pageData.pageSize"
          :layout="pageData.layout"
          :total="pageData.total"
        ></el-pagination>
      </div>-->
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="confirm">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { refundGoods } from "@/api/salesReturn/salesReturnList";
export default {
  props: {
    dialog: Object
  },
  data() {
    return {
      tableData: []
      // pageData: {
      //   pageSizes: [10, 20],
      //   pageSize: 10,
      //   page: 1,
      //   total: null,
      //   layout: "total, sizes, prev, pager, next, jumper"
      // }
    };
  },
  methods: {
    confirm() {
      this.dialog.centerDialogVisible = false;
    },
    getData() {
      let data = {
        // limit: this.pageData.pageSize,
        // page: this.pageData.page,
        returnid: this.dialog.id
      };
      refundGoods(data).then(res => {
        if (res.code == 0) {
          this.tableData = res.data;
          // this.pageData.page = res.data.current_page;
          //   this.pageData.pagesize = res.data.per_page;
          //   this.pageData.total = res.data.total;
        }
      });
    },
    //每页多少条
    handleCurrentChange(val) {
      this.pageData.page = 1;
      this.pageData.pageSize = val;
      this.getData();
    },
    //选取页数
    handleSizeChange(page) {
      this.pageData.page = page;
      this.getData();
    }
  }
};
</script>
<style scoped>
.pagination {
  text-align: right;
  padding: 10px;
}
</style>